{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "import scrapy\n",
    "import scrapy.crawler as crawler\n",
    "from multiprocessing import Process, Queue\n",
    "from twisted.internet import reactor\n",
    "import logging"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "\n",
    "class JsonWriterPipeline(object):\n",
    "\n",
    "    def open_spider(self, spider):\n",
    "        self.file = open('quoteresult.jl', 'w')\n",
    "\n",
    "    def close_spider(self, spider):\n",
    "        self.file.close()\n",
    "\n",
    "    def process_item(self, item, spider):\n",
    "        line = json.dumps(dict(item)) + \"\\n\"\n",
    "        self.file.write(line)\n",
    "        return item"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "# the wrapper to make it run more times\n",
    "def run_spider(spider):\n",
    "    def f(q):\n",
    "        try:\n",
    "            runner = crawler.CrawlerRunner()\n",
    "            deferred = runner.crawl(spider)\n",
    "            deferred.addBoth(lambda _: reactor.stop())\n",
    "            reactor.run()\n",
    "            q.put(None)\n",
    "        except Exception as e:\n",
    "            q.put(e)\n",
    "\n",
    "    q = Queue()\n",
    "    p = Process(target=f, args=(q,))\n",
    "    p.start()\n",
    "    result = q.get()\n",
    "    p.join()\n",
    "\n",
    "    if result is not None:\n",
    "        raise result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "class QuotesSpider(scrapy.Spider):\n",
    "    name = \"quotes\"\n",
    "    start_urls = [\n",
    "        'http://quotes.toscrape.com/page/1/'\n",
    "    ]\n",
    "    custom_settings = {\n",
    "        'LOG_LEVEL': logging.WARNING,\n",
    "        'ITEM_PIPELINES': {'__main__.JsonWriterPipeline': 1}, # Used for pipeline 1\n",
    "        'FEED_FORMAT':'json',                                 # Used for pipeline 2\n",
    "        'FEED_URI': 'quoteresult.json'                        # Used for pipeline 2\n",
    "    }\n",
    "\n",
    "    def parse(self, response):\n",
    "        for quote in response.css('div.quote'):\n",
    "             yield {\n",
    "                'text': quote.css('span.text::text').get(),\n",
    "                'author': quote.css('small.author::text').get(),\n",
    "                'tags': quote.css('div.tags a.tag::text').getall(),\n",
    "            }\n",
    "        next_page = response.css('li.next a::attr(href)').get()\n",
    "        if next_page is not None:\n",
    "            yield response.follow(next_page, callback=self.parse)\n",
    "        \n",
    "        #page = response.url.split(\"/\")[-2]\n",
    "        #filename = 'quotes-%s.html' % page\n",
    "        #with open(filename, 'wb') as f:\n",
    "        #    f.write(dic)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " response.follow just returns a Request instance; you still have to yield this Request."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "process.crawl(QuotesSpider)\n",
    "process.start()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "first run:\n"
     ]
    }
   ],
   "source": [
    "print('first run:')\n",
    "run_spider(QuotesSpider)\n",
    "\n",
    "#print('\\nsecond run:')\n",
    "#run_spider(QuotesSpider)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Python-crawler.ipynb quoteresult.json     quotes-2.html\n",
      "quoteresult.jl       quotes-1.html        \u001b[34mtutorial\u001b[m\u001b[m\n"
     ]
    }
   ],
   "source": [
    "!ls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "qt = pd.read_json('quoteresult.json')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>author</th>\n",
       "      <th>tags</th>\n",
       "      <th>text</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Albert Einstein</td>\n",
       "      <td>[change, deep-thoughts, thinking, world]</td>\n",
       "      <td>“The world as we have created it is a process ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>J.K. Rowling</td>\n",
       "      <td>[abilities, choices]</td>\n",
       "      <td>“It is our choices, Harry, that show what we t...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Albert Einstein</td>\n",
       "      <td>[inspirational, life, live, miracle, miracles]</td>\n",
       "      <td>“There are only two ways to live your life. On...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Jane Austen</td>\n",
       "      <td>[aliteracy, books, classic, humor]</td>\n",
       "      <td>“The person, be it gentleman or lady, who has ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Marilyn Monroe</td>\n",
       "      <td>[be-yourself, inspirational]</td>\n",
       "      <td>“Imperfection is beauty, madness is genius and...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Albert Einstein</td>\n",
       "      <td>[adulthood, success, value]</td>\n",
       "      <td>“Try not to become a man of success. Rather be...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>André Gide</td>\n",
       "      <td>[life, love]</td>\n",
       "      <td>“It is better to be hated for what you are tha...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Thomas A. Edison</td>\n",
       "      <td>[edison, failure, inspirational, paraphrased]</td>\n",
       "      <td>“I have not failed. I've just found 10,000 way...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Eleanor Roosevelt</td>\n",
       "      <td>[misattributed-eleanor-roosevelt]</td>\n",
       "      <td>“A woman is like a tea bag; you never know how...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Steve Martin</td>\n",
       "      <td>[humor, obvious, simile]</td>\n",
       "      <td>“A day without sunshine is like, you know, nig...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Marilyn Monroe</td>\n",
       "      <td>[friends, heartbreak, inspirational, life, lov...</td>\n",
       "      <td>“This life is what you make it. No matter what...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>J.K. Rowling</td>\n",
       "      <td>[courage, friends]</td>\n",
       "      <td>“It takes a great deal of bravery to stand up ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Albert Einstein</td>\n",
       "      <td>[simplicity, understand]</td>\n",
       "      <td>“If you can't explain it to a six year old, yo...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Bob Marley</td>\n",
       "      <td>[love]</td>\n",
       "      <td>“You may not be her first, her last, or her on...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Dr. Seuss</td>\n",
       "      <td>[fantasy]</td>\n",
       "      <td>“I like nonsense, it wakes up the brain cells....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Douglas Adams</td>\n",
       "      <td>[life, navigation]</td>\n",
       "      <td>“I may not have gone where I intended to go, b...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Elie Wiesel</td>\n",
       "      <td>[activism, apathy, hate, indifference, inspira...</td>\n",
       "      <td>“The opposite of love is not hate, it's indiff...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Friedrich Nietzsche</td>\n",
       "      <td>[friendship, lack-of-friendship, lack-of-love,...</td>\n",
       "      <td>“It is not a lack of love, but a lack of frien...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Mark Twain</td>\n",
       "      <td>[books, contentment, friends, friendship, life]</td>\n",
       "      <td>“Good friends, good books, and a sleepy consci...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Allen Saunders</td>\n",
       "      <td>[fate, life, misattributed-john-lennon, planni...</td>\n",
       "      <td>“Life is what happens to us while we are makin...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Pablo Neruda</td>\n",
       "      <td>[love, poetry]</td>\n",
       "      <td>“I love you without knowing how, or when, or f...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Ralph Waldo Emerson</td>\n",
       "      <td>[happiness]</td>\n",
       "      <td>“For every minute you are angry you lose sixty...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Mother Teresa</td>\n",
       "      <td>[attributed-no-source]</td>\n",
       "      <td>“If you judge people, you have no time to love...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Garrison Keillor</td>\n",
       "      <td>[humor, religion]</td>\n",
       "      <td>“Anyone who thinks sitting in church can make ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>Jim Henson</td>\n",
       "      <td>[humor]</td>\n",
       "      <td>“Beauty is in the eye of the beholder and it m...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>Dr. Seuss</td>\n",
       "      <td>[comedy, life, yourself]</td>\n",
       "      <td>“Today you are You, that is truer than true. T...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>Albert Einstein</td>\n",
       "      <td>[children, fairy-tales]</td>\n",
       "      <td>“If you want your children to be intelligent, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>J.K. Rowling</td>\n",
       "      <td>[]</td>\n",
       "      <td>“It is impossible to live without failing at s...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>Albert Einstein</td>\n",
       "      <td>[imagination]</td>\n",
       "      <td>“Logic will get you from A to Z; imagination w...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>Bob Marley</td>\n",
       "      <td>[music]</td>\n",
       "      <td>“One good thing about music, when it hits you,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>70</th>\n",
       "      <td>Alfred Tennyson</td>\n",
       "      <td>[friendship, love]</td>\n",
       "      <td>“If I had a flower for every time I thought of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>71</th>\n",
       "      <td>Charles Bukowski</td>\n",
       "      <td>[humor]</td>\n",
       "      <td>“Some people never go crazy. What truly horrib...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>72</th>\n",
       "      <td>Terry Pratchett</td>\n",
       "      <td>[humor, open-mind, thinking]</td>\n",
       "      <td>“The trouble with having an open mind, of cour...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>73</th>\n",
       "      <td>Dr. Seuss</td>\n",
       "      <td>[humor, philosophy]</td>\n",
       "      <td>“Think left and think right and think low and ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>74</th>\n",
       "      <td>J.D. Salinger</td>\n",
       "      <td>[authors, books, literature, reading, writing]</td>\n",
       "      <td>“What really knocks me out is a book that, whe...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>George Carlin</td>\n",
       "      <td>[humor, insanity, lies, lying, self-indulgence...</td>\n",
       "      <td>“The reason I talk to myself is because I’m th...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>76</th>\n",
       "      <td>John Lennon</td>\n",
       "      <td>[beatles, connection, dreamers, dreaming, drea...</td>\n",
       "      <td>“You may say I'm a dreamer, but I'm not the on...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>77</th>\n",
       "      <td>W.C. Fields</td>\n",
       "      <td>[humor, sinister]</td>\n",
       "      <td>“I am free of all prejudice. I hate everyone e...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>78</th>\n",
       "      <td>Ayn Rand</td>\n",
       "      <td>[]</td>\n",
       "      <td>“The question isn't who is going to let me; it...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>79</th>\n",
       "      <td>Mark Twain</td>\n",
       "      <td>[books, classic, reading]</td>\n",
       "      <td>“′Classic′ - a book which people praise and do...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>80</th>\n",
       "      <td>Albert Einstein</td>\n",
       "      <td>[mistakes]</td>\n",
       "      <td>“Anyone who has never made a mistake has never...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>81</th>\n",
       "      <td>Jane Austen</td>\n",
       "      <td>[humor, love, romantic, women]</td>\n",
       "      <td>“A lady's imagination is very rapid; it jumps ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>82</th>\n",
       "      <td>J.K. Rowling</td>\n",
       "      <td>[integrity]</td>\n",
       "      <td>“Remember, if the time should come when you ha...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>83</th>\n",
       "      <td>Jane Austen</td>\n",
       "      <td>[books, library, reading]</td>\n",
       "      <td>“I declare after all there is no enjoyment lik...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>84</th>\n",
       "      <td>Jane Austen</td>\n",
       "      <td>[elizabeth-bennet, jane-austen]</td>\n",
       "      <td>“There are few people whom I really love, and ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>85</th>\n",
       "      <td>C.S. Lewis</td>\n",
       "      <td>[age, fairytales, growing-up]</td>\n",
       "      <td>“Some day you will be old enough to start read...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86</th>\n",
       "      <td>C.S. Lewis</td>\n",
       "      <td>[god]</td>\n",
       "      <td>“We are not necessarily doubting that God will...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>87</th>\n",
       "      <td>Mark Twain</td>\n",
       "      <td>[death, life]</td>\n",
       "      <td>“The fear of death follows from the fear of li...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>88</th>\n",
       "      <td>Mark Twain</td>\n",
       "      <td>[misattributed-mark-twain, truth]</td>\n",
       "      <td>“A lie can travel half way around the world wh...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>C.S. Lewis</td>\n",
       "      <td>[christianity, faith, religion, sun]</td>\n",
       "      <td>“I believe in Christianity as I believe that t...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90</th>\n",
       "      <td>J.K. Rowling</td>\n",
       "      <td>[truth]</td>\n",
       "      <td>“The truth.\" Dumbledore sighed. \"It is a beaut...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>Jimi Hendrix</td>\n",
       "      <td>[death, life]</td>\n",
       "      <td>“I'm the one that's got to die when it's time ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>J.M. Barrie</td>\n",
       "      <td>[adventure, love]</td>\n",
       "      <td>“To die will be an awfully big adventure.”</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>93</th>\n",
       "      <td>E.E. Cummings</td>\n",
       "      <td>[courage]</td>\n",
       "      <td>“It takes courage to grow up and become who yo...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>94</th>\n",
       "      <td>Khaled Hosseini</td>\n",
       "      <td>[life]</td>\n",
       "      <td>“But better to get hurt by the truth than comf...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>Harper Lee</td>\n",
       "      <td>[better-life-empathy]</td>\n",
       "      <td>“You never really understand a person until yo...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>Madeleine L'Engle</td>\n",
       "      <td>[books, children, difficult, grown-ups, write,...</td>\n",
       "      <td>“You have to write the book that wants to be w...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>Mark Twain</td>\n",
       "      <td>[truth]</td>\n",
       "      <td>“Never tell the truth to people who are not wo...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>Dr. Seuss</td>\n",
       "      <td>[inspirational]</td>\n",
       "      <td>“A person's a person, no matter how small.”</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>George R.R. Martin</td>\n",
       "      <td>[books, mind]</td>\n",
       "      <td>“... a mind needs books as a sword needs a whe...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                 author                                               tags  \\\n",
       "0       Albert Einstein           [change, deep-thoughts, thinking, world]   \n",
       "1          J.K. Rowling                               [abilities, choices]   \n",
       "2       Albert Einstein     [inspirational, life, live, miracle, miracles]   \n",
       "3           Jane Austen                 [aliteracy, books, classic, humor]   \n",
       "4        Marilyn Monroe                       [be-yourself, inspirational]   \n",
       "5       Albert Einstein                        [adulthood, success, value]   \n",
       "6            André Gide                                       [life, love]   \n",
       "7      Thomas A. Edison      [edison, failure, inspirational, paraphrased]   \n",
       "8     Eleanor Roosevelt                  [misattributed-eleanor-roosevelt]   \n",
       "9          Steve Martin                           [humor, obvious, simile]   \n",
       "10       Marilyn Monroe  [friends, heartbreak, inspirational, life, lov...   \n",
       "11         J.K. Rowling                                 [courage, friends]   \n",
       "12      Albert Einstein                           [simplicity, understand]   \n",
       "13           Bob Marley                                             [love]   \n",
       "14            Dr. Seuss                                          [fantasy]   \n",
       "15        Douglas Adams                                 [life, navigation]   \n",
       "16          Elie Wiesel  [activism, apathy, hate, indifference, inspira...   \n",
       "17  Friedrich Nietzsche  [friendship, lack-of-friendship, lack-of-love,...   \n",
       "18           Mark Twain    [books, contentment, friends, friendship, life]   \n",
       "19       Allen Saunders  [fate, life, misattributed-john-lennon, planni...   \n",
       "20         Pablo Neruda                                     [love, poetry]   \n",
       "21  Ralph Waldo Emerson                                        [happiness]   \n",
       "22        Mother Teresa                             [attributed-no-source]   \n",
       "23     Garrison Keillor                                  [humor, religion]   \n",
       "24           Jim Henson                                            [humor]   \n",
       "25            Dr. Seuss                           [comedy, life, yourself]   \n",
       "26      Albert Einstein                            [children, fairy-tales]   \n",
       "27         J.K. Rowling                                                 []   \n",
       "28      Albert Einstein                                      [imagination]   \n",
       "29           Bob Marley                                            [music]   \n",
       "..                  ...                                                ...   \n",
       "70      Alfred Tennyson                                 [friendship, love]   \n",
       "71     Charles Bukowski                                            [humor]   \n",
       "72      Terry Pratchett                       [humor, open-mind, thinking]   \n",
       "73            Dr. Seuss                                [humor, philosophy]   \n",
       "74        J.D. Salinger     [authors, books, literature, reading, writing]   \n",
       "75        George Carlin  [humor, insanity, lies, lying, self-indulgence...   \n",
       "76          John Lennon  [beatles, connection, dreamers, dreaming, drea...   \n",
       "77          W.C. Fields                                  [humor, sinister]   \n",
       "78             Ayn Rand                                                 []   \n",
       "79           Mark Twain                          [books, classic, reading]   \n",
       "80      Albert Einstein                                         [mistakes]   \n",
       "81          Jane Austen                     [humor, love, romantic, women]   \n",
       "82         J.K. Rowling                                        [integrity]   \n",
       "83          Jane Austen                          [books, library, reading]   \n",
       "84          Jane Austen                    [elizabeth-bennet, jane-austen]   \n",
       "85           C.S. Lewis                      [age, fairytales, growing-up]   \n",
       "86           C.S. Lewis                                              [god]   \n",
       "87           Mark Twain                                      [death, life]   \n",
       "88           Mark Twain                  [misattributed-mark-twain, truth]   \n",
       "89           C.S. Lewis               [christianity, faith, religion, sun]   \n",
       "90         J.K. Rowling                                            [truth]   \n",
       "91         Jimi Hendrix                                      [death, life]   \n",
       "92          J.M. Barrie                                  [adventure, love]   \n",
       "93        E.E. Cummings                                          [courage]   \n",
       "94      Khaled Hosseini                                             [life]   \n",
       "95           Harper Lee                              [better-life-empathy]   \n",
       "96    Madeleine L'Engle  [books, children, difficult, grown-ups, write,...   \n",
       "97           Mark Twain                                            [truth]   \n",
       "98            Dr. Seuss                                    [inspirational]   \n",
       "99   George R.R. Martin                                      [books, mind]   \n",
       "\n",
       "                                                 text  \n",
       "0   “The world as we have created it is a process ...  \n",
       "1   “It is our choices, Harry, that show what we t...  \n",
       "2   “There are only two ways to live your life. On...  \n",
       "3   “The person, be it gentleman or lady, who has ...  \n",
       "4   “Imperfection is beauty, madness is genius and...  \n",
       "5   “Try not to become a man of success. Rather be...  \n",
       "6   “It is better to be hated for what you are tha...  \n",
       "7   “I have not failed. I've just found 10,000 way...  \n",
       "8   “A woman is like a tea bag; you never know how...  \n",
       "9   “A day without sunshine is like, you know, nig...  \n",
       "10  “This life is what you make it. No matter what...  \n",
       "11  “It takes a great deal of bravery to stand up ...  \n",
       "12  “If you can't explain it to a six year old, yo...  \n",
       "13  “You may not be her first, her last, or her on...  \n",
       "14  “I like nonsense, it wakes up the brain cells....  \n",
       "15  “I may not have gone where I intended to go, b...  \n",
       "16  “The opposite of love is not hate, it's indiff...  \n",
       "17  “It is not a lack of love, but a lack of frien...  \n",
       "18  “Good friends, good books, and a sleepy consci...  \n",
       "19  “Life is what happens to us while we are makin...  \n",
       "20  “I love you without knowing how, or when, or f...  \n",
       "21  “For every minute you are angry you lose sixty...  \n",
       "22  “If you judge people, you have no time to love...  \n",
       "23  “Anyone who thinks sitting in church can make ...  \n",
       "24  “Beauty is in the eye of the beholder and it m...  \n",
       "25  “Today you are You, that is truer than true. T...  \n",
       "26  “If you want your children to be intelligent, ...  \n",
       "27  “It is impossible to live without failing at s...  \n",
       "28  “Logic will get you from A to Z; imagination w...  \n",
       "29  “One good thing about music, when it hits you,...  \n",
       "..                                                ...  \n",
       "70  “If I had a flower for every time I thought of...  \n",
       "71  “Some people never go crazy. What truly horrib...  \n",
       "72  “The trouble with having an open mind, of cour...  \n",
       "73  “Think left and think right and think low and ...  \n",
       "74  “What really knocks me out is a book that, whe...  \n",
       "75  “The reason I talk to myself is because I’m th...  \n",
       "76  “You may say I'm a dreamer, but I'm not the on...  \n",
       "77  “I am free of all prejudice. I hate everyone e...  \n",
       "78  “The question isn't who is going to let me; it...  \n",
       "79  “′Classic′ - a book which people praise and do...  \n",
       "80  “Anyone who has never made a mistake has never...  \n",
       "81  “A lady's imagination is very rapid; it jumps ...  \n",
       "82  “Remember, if the time should come when you ha...  \n",
       "83  “I declare after all there is no enjoyment lik...  \n",
       "84  “There are few people whom I really love, and ...  \n",
       "85  “Some day you will be old enough to start read...  \n",
       "86  “We are not necessarily doubting that God will...  \n",
       "87  “The fear of death follows from the fear of li...  \n",
       "88  “A lie can travel half way around the world wh...  \n",
       "89  “I believe in Christianity as I believe that t...  \n",
       "90  “The truth.\" Dumbledore sighed. \"It is a beaut...  \n",
       "91  “I'm the one that's got to die when it's time ...  \n",
       "92         “To die will be an awfully big adventure.”  \n",
       "93  “It takes courage to grow up and become who yo...  \n",
       "94  “But better to get hurt by the truth than comf...  \n",
       "95  “You never really understand a person until yo...  \n",
       "96  “You have to write the book that wants to be w...  \n",
       "97  “Never tell the truth to people who are not wo...  \n",
       "98        “A person's a person, no matter how small.”  \n",
       "99  “... a mind needs books as a sword needs a whe...  \n",
       "\n",
       "[100 rows x 3 columns]"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "qt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
